Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a compatibility error in CredentialsProvider #495

Merged

Conversation

Vlatombe
Copy link
Member

@Vlatombe Vlatombe commented Nov 8, 2023

Follows up #490

Prefer calling deprecated overrides of getCredentials(..., Item, ...) if implemented rather than resolving closest ItemGroup.

Testing done

Submitter checklist

Prefer calling deprecated overrides of `getCredentials(..., Item, ...)` if implemented rather than resolving closest `ItemGroup`.
@Vlatombe Vlatombe requested a review from a team as a code owner November 8, 2023 13:31
@@ -1255,7 +1255,7 @@ public <C extends Credentials> List<C> getCredentials(@NonNull Class<C> type,
@NonNull Item item,
@Nullable org.acegisecurity.Authentication authentication) {
Objects.requireNonNull(item);
return getCredentialsInItemGroup(type, item.getParent(), authentication == null ? null : authentication.toSpring(), List.of());
return getCredentialsInItemFallback(type, item, authentication == null ? null : authentication.toSpring(), List.of());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prevents infinite recursion in case the overrides delegates to super implementation.

@Vlatombe Vlatombe requested a review from jglick November 8, 2023 13:47
@jglick jglick added the bug label Nov 8, 2023
@jtnord jtnord merged commit 8835d63 into jenkinsci:master Nov 9, 2023
15 checks passed
@Vlatombe Vlatombe deleted the credentialsprovider-compatibility-fix branch November 9, 2023 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants